<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<h:head>
	<title>Results</title>
</h:head>
<h:body>
	<p:layoutUnit id="top" position="north" size="15%">
		<p:toolbar>
			<p:toolbarGroup align="left">
				<h3><h:link outcome="home.html" value="TravelDream" /></h3>
			</p:toolbarGroup>
			<p:toolbarGroup align="right">
				<h:form>
					<p:commandButton action="#{logoutBean.logout}" value="Logout" />
				</h:form>
				<p:spacer width="10"></p:spacer>
				<p:spacer width="10"></p:spacer>
			</p:toolbarGroup>
		</p:toolbar>
	</p:layoutUnit>


	<h:form id="formF" rendered="#{searchBean.renderFlight}">

		<p:growl id="msgF" showDetail="true" />

		<p:dataTable id="filteredList" var="FlightDTO"
			value="#{searchBean.filteredList}">

			

			<p:column headerText="Date" style="width:24%">
				<h:outputText value="#{FlightDTO.date_Time}" />
			</p:column>
			
			<p:column headerText="Flag" style="width:24%">
				<h:outputText value="#{FlightDTO.flag}" />
			</p:column>
			
			
			<p:column headerText="Price" style="width:24%">
				<h:outputText value="#{FlightDTO.price}" />
			</p:column>

			<p:column headerText="Commands" style="width:12%">
				<p:commandButton id="selectButtonF" update=":formF:displayF"
					oncomplete="PF('flightDialog').show()" icon="ui-icon-search"
					title="View">
					<f:setPropertyActionListener value="#{FlightDTO}"
						target="#{searchBean.selectedFlight}" />
				</p:commandButton>

				<p:commandButton id="selectButtonF2"
					title="Use this as outbound flight"
					action="#{savedPackageBean.createSavedFromOutFlight()}"
					icon="ui-icon-arrowreturnthick-1-n">
					<f:setPropertyActionListener value="#{FlightDTO}"
						target="#{savedPackageBean.selectedFlight}" />
				</p:commandButton>

				<p:commandButton id="selectButtonF3"
					title="Use this as return flight"
					action="#{savedPackageBean.createSavedFromRetFlight()}"
					icon=" ui-icon-arrowreturnthick-1-s ">
					<f:setPropertyActionListener value="#{FlightDTO}"
						target="#{savedPackageBean.selectedRetFlight}" />
				</p:commandButton>
			</p:column>

		</p:dataTable>

		<p:dialog header="Flight Detail" widgetVar="flightDialog"
			resizable="false" id="FDlg" showEffect="fade" hideEffect="explode"
			modal="true">

			<h:panelGrid id="displayF" columns="2" cellpadding="4"
				style="margin:0 auto;">

				<f:facet name="header">  
                FLIGHT  
            </f:facet>

				<h:outputText value="Departure Airport" />
				<h:outputText value="#{searchBean.selectedFlight.depAirport}"
					style="font-weight:bold" />

				<h:outputText value="Arrival Airport:" />
				<h:outputText value="#{searchBean.selectedFlight.arrAirport}"
					style="font-weight:bold" />


				<h:outputText value="Description:" />
				<h:outputText value="#{searchBean.selectedFlight.description}"
					style="font-weight:bold" />

				<h:outputText value="Flag:" />
				<h:outputText value="#{searchBean.selectedFlight.flag}"
					style="font-weight:bold" />

				<h:outputText value="Price:" />
				<h:outputText value="#{searchBean.selectedFlight.price}"
					style="font-weight:bold" />

				<h:outputText value="Capacity:" />
				<h:outputText value="#{searchBean.selectedFlight.capacity}"
					style="font-weight:bold" />

			</h:panelGrid>

		</p:dialog>

	</h:form>



	<h:form id="formH" rendered="#{searchBean.renderHotel}">

		<p:growl id="msgH" showDetail="true" />

		<p:dataTable id="filteredListH" var="HotelDTO"
			value="#{searchBean.filteredListH}">

			<p:column headerText="Name" style="width:24%">
				<h:outputText value="#{HotelDTO.name}" />
			</p:column>

			<p:column headerText="Price" style="width:24%">
				<h:outputText value="#{HotelDTO.price_Night}" />
			</p:column>

			<p:column headerText="Country" style="width:24%">
				<h:outputText value="#{HotelDTO.country}" />
			</p:column>

			<p:column headerText="City" style="width:24%">
				<h:outputText value="#{HotelDTO.city}" />
			</p:column>

			<p:column style="width:4%">
				<p:commandButton id="selectButtonH" update=":formH:displayH"
					oncomplete="PF('hotelDialog').show()" icon="ui-icon-search"
					title="View">
					<f:setPropertyActionListener value="#{HotelDTO}"
						target="#{searchBean.selectedHotel}" />
				</p:commandButton>
			</p:column>

			<p:column style="width:4%">
				<p:commandButton id="selectButtonH2" value="Select"
					action="#{savedPackageBean.createSavedFromHotel()}">
					<f:setPropertyActionListener value="#{HotelDTO}"
						target="#{savedPackageBean.selectedHotel}" />
				</p:commandButton>
			</p:column>

		</p:dataTable>

		<p:dialog header="Hotel Detail" widgetVar="hotelDialog"
			resizable="false" id="HDlg" showEffect="fade" hideEffect="explode"
			modal="true">

			<h:panelGrid id="displayH" columns="2" cellpadding="4"
				style="margin:0 auto;">

				<f:facet name="header">
					<h:outputText value="#{searchBean.selectedHotel.name}"
						style="font-weight:bold" />
				</f:facet>

				<h:outputText value="Address:" />
				<h:outputText value="#{searchBean.selectedHotel.address}"
					style="font-weight:bold" />

				<h:outputText value="Cap:" />
				<h:outputText value="#{searchBean.selectedHotel.cap}"
					style="font-weight:bold" />


				<h:outputText value="Description:" />
				<h:outputText value="#{searchBean.selectedHotel.description}"
					style="font-weight:bold" />

				<h:outputText value="Web-site:" />
				<h:outputText value="#{searchBean.selectedHotel.website}"
					style="font-weight:bold" />

				<h:outputText value="Category:" />
				<h:outputText value="#{searchBean.selectedHotel.category}"
					style="font-weight:bold" />
			</h:panelGrid>

		</p:dialog>

	</h:form>

	<h:form id="formE" rendered="#{searchBean.renderExcursion}">

		<p:growl id="msgE" showDetail="true" />

		<p:dataTable id="filteredListE" var="ExcursionDTO"
			value="#{searchBean.filteredListE}">

			<p:column headerText="Name" style="width:24%">
				<h:outputText value="#{ExcursionDTO.name}" />
			</p:column>

			<p:column headerText="City" style="width:24%">
				<h:outputText value="#{ExcursionDTO.city}" />
			</p:column>

			<p:column headerText="Date" style="width:24%">
				<h:outputText value="#{ExcursionDTO.date}" />
			</p:column>

			<p:column headerText="Price" style="width:24%">
				<h:outputText value="#{ExcursionDTO.price}" />
			</p:column>

			<p:column style="width:4%">
				<p:commandButton id="selectButton" update=":formE:displayE"
					oncomplete="PF('excursionDialog').show()" icon="ui-icon-search"
					title="View">
					<f:setPropertyActionListener value="#{ExcursionDTO}"
						target="#{searchBean.selectedExcursion}" />
				</p:commandButton>
			</p:column>

			<p:column style="width:4%">
				<p:commandButton id="selectButtonE2" value="Select"
					action="#{savedPackageBean.createSavedFromExcursion()}">
					<f:setPropertyActionListener value="#{ExcursionDTO}"
						target="#{savedPackageBean.selectedExcursion}" />
				</p:commandButton>
			</p:column>

		</p:dataTable>

		<p:dialog header="Excursion Detail" widgetVar="excursionDialog"
			resizable="false" id="EDlg" showEffect="fade" hideEffect="explode"
			modal="true">

			<h:panelGrid id="displayE" columns="2" cellpadding="4"
				style="margin:0 auto;">

				<f:facet name="header">
					<h:outputText value="#{searchBean.selectedExcursion.name}"
						style="font-weight:bold" />
				</f:facet>

				<h:outputText value="Capacity:" />
				<h:outputText value="#{searchBean.selectedExcursion.capacity}"
					style="font-weight:bold" />

				<h:outputText value="Type:" />
				<h:outputText value="#{searchBean.selectedExcursion.type}"
					style="font-weight:bold" />


				<h:outputText value="web-site:" />
				<h:outputText value="#{searchBean.selectedExcursion.website}"
					style="font-weight:bold" />


				<h:outputText value="Description:" />
				<h:outputText value="#{searchBean.selectedExcursion.description}"
					style="font-weight:bold" />


			</h:panelGrid>

		</p:dialog>

	</h:form>

	<h:form id="formBP" rendered="#{searchBean.renderBasePackage}">

		<p:dataTable id="filteredListBP" var="BasePackageDTO"
			value="#{searchBean.filteredListBP}">

			<p:column headerText="Departure Location" style="width:24%">
				<h:outputText value="#{BasePackageDTO.depLocation}" />
			</p:column>

			<p:column headerText="Arrival Location" style="width:24%">
				<h:outputText value="#{BasePackageDTO.arrLocation}" />
			</p:column>

			<p:column headerText="Departure date" style="width:24%">
				<h:outputText value="#{BasePackageDTO.depDate}" />
			</p:column>
			
			<p:column headerText="Retur date" style="width:24%">
				<h:outputText value="#{BasePackageDTO.depDate}" />
			</p:column>
			<p:column headerText="Commands" style="width:4%">
						<p:commandButton id="selectBPButton" 
							icon="ui-icon-wrench"
							title="Start creating your personalized package from our suggestion" action="#{savedPackageBean.createSavedFromBasePackage()}">
							<f:setPropertyActionListener value="#{BasePackageDTO}"
								target="#{savedPackageBean.basePackage}" />
						</p:commandButton>
					</p:column>



		</p:dataTable>
	</h:form>



</h:body>
</html>